def cj(num_judges):
    """
    计算去掉最高分和最低分后的平均分
    """
    scores = []
    
    # 输入每个评委的打分
    for i in range(num_judges):
        while True:
            try:
                score = float(input("请输入第{}个评委的打分（0-100）：".format(i+1)))
                if score < 0 or score > 100:
                    raise ValueError("分数必须在0-100之间")
                scores.append(score)
                break
            except ValueError as e:
                print("输入错误：{}".format(e))
    
    # 删除最高分和最低分
    try:
        scores.remove(max(scores))
        scores.remove(min(scores))
    except ValueError:
        # 如果所有分数都相等或者无效，则不做处理
        pass
    
    # 计算平均分
    if scores:
        average_score = sum(scores) / len(scores)
    else:
        average_score = 0.0
    
    return average_score

while True:
    try:
        num_judges = int(input("请输入评委人数："))
        if num_judges < 3:
            raise ValueError("评委人数必须大于等于3")
        break
    except ValueError as e:
        print("输入错误：{}".format(e))

average_score = cj(num_judges)

print("去掉最高分和最低分后的平均分为：{:.2f}".format(average_score))